class Dsler < ActiveRecord::Base
  attr_reader :verify_password
  attr_writer :verify_password
  validates_presence_of :name,
                        :message => 'this is important for you to post articles.'
  validates_presence_of :password, 
                        :message => 'your password cannot be empty.'                        
  validates_uniqueness_of :email, 
                          :message => 'a user with the email you specified already exists.'                          
  validates_format_of :email, 
                      :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i,
                      :message => 'please specify a valid email address.'
  protected
  def validate
    @verify_password = '' unless @verify_password != nil
    errors.add(:verify_password, "password mismatch, please verify your input.") unless password == @verify_password
  end
end
